# 使用bs4获取58首页信息

url = "https://bj.58.com/"

import urllib.request

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0",
}
request = urllib.request.Request(url, headers=headers)
response = urllib.request.urlopen(request)
content = response.read().decode("utf8")
# print(content)
# 教育培训
import bs4

soup = bs4.BeautifulSoup(content,"lxml")
l = soup.select("div a")
print(len(l))
